<template>
  <div class="collect-page">
    <van-nav-bar fixed title="我的关注" />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
    <ArticleItem  v-for=" item in listData" :key="item.id" :item="item"></ArticleItem>

    </van-list>
  </div>
</template>

<script>
import { list } from '@/api/article'
export default {
  name: 'CollectPage',
  data () {
    return {
      finished: false,
      loading: false,
      optType: 1,
      pageSize: 5,
      page: 1,
      listData: []

    }
  },
  methods: {
    async onLoad () {
      const res = await list(1, this.pageSize, this.page)
      this.listData.push(...res.data.rows)

      this.page++
      this.loading = false
      if (this.page >= res.data.total) {
        this.finished = true
      }
    }
  }
}
</script>

<style lang="less" scoped>
.collect-page {
  margin-bottom: 50px;
  margin-top: 44px;
}
</style>
